// 响应体 Dto
import { LoggerInterceptor } from '@/interceptor/logger.interceptor';
/*
 * @Description:
 * @Version: 2.0
 * @Author: cwind
 * @Date: 2022-10-27 10:37:28
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2025-05-13 17:13:08
 */
import { Controller, Get, UseGuards, UseInterceptors } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import {
  ApiBearerAuth,
  ApiHeader,
  ApiOkResponse,
  ApiOperation,
  ApiTags,
} from '@nestjs/swagger'; // swagger 接口文档

import { ResponseMenuManagementDto } from './dto';
import { MenusManagementService } from './menus-management.service'; // MenuManagement Service

/* swagger 文档 */
@ApiBearerAuth()
@ApiHeader({
  name: 'Authorization',
  required: true,
  description: 'token令牌',
})
@ApiTags('系统设置-菜单管理')
@Controller('system/menu')
@UseGuards(AuthGuard('jwt'))
@UseInterceptors(LoggerInterceptor)
export class MenusManagementController {
  constructor(
    private readonly menusManagementService: MenusManagementService,
  ) {}

  /**
   * @description: 获取菜单管理列表
   * @author: cwind
   */
  @ApiOkResponse({ type: ResponseMenuManagementDto })
  @ApiOperation({ summary: '获取菜单管理列表' })
  @Get('/list')
  async getMenuList() {
    const response = await this.menusManagementService.getMenuList();
    return response;
  }
}
